package com.jerry.project;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import javax.servlet.http.HttpServletRequest;

public class reqToJSONString {
	public static String reqToJSONString(HttpServletRequest req){
		StringBuffer buf = new StringBuffer();
		char[] c = new char[1024];
		int len;
		try {
			while((len = req.getReader().read(c)) != -1) {
				buf.append(c, 0, len);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String s=null;
		try {
			s= URLDecoder.decode(buf.toString(),"UTF-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return buf.toString();
		
	}
}
